package com.workplan.client.widgets.historymodal;

import net.customware.gwt.presenter.client.widget.WidgetDisplay;

import com.general.client.basewidget.BaseWidget;
import com.general.client.bundle.CommonBundle;
import com.general.client.widgets.modalwindow.ModalWindow;
import com.general.client.widgets.styledlist.StyledList;
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;

public class HistoryModal extends BaseWidget implements
		HistoryModalPresenter.Display {
	@UiField
	ModalWindow modal;

	@UiField
	Label headerLabel;

	@UiField
	StyledList list;

	@UiField
	CommonBundle common;

	private static HistoryModalUiBinder uiBinder = GWT
			.create(HistoryModalUiBinder.class);

	interface HistoryModalUiBinder extends UiBinder<Widget, HistoryModal> {
	}

	public HistoryModal() {
		initWidget(uiBinder.createAndBindUi(this));
	}

	@Override
	public void show(boolean show) {
		modal.show(show);
	}

	@Override
	public void setName(String name) {
		headerLabel.setText(name);
	}

	@Override
	public void addMonthItem(String month) {
		Label l = new Label(month);
		l.addStyleName(common.text().labelText());
		list.add(l);
	}

	@Override
	public void addShiftItem(WidgetDisplay display) {
		list.add(display.asWidget());

	}
}
